//
//  MainCatergyV.m
//  LoveDraw
//
//  Created by 零零壹 on 2017/9/22.
//  Copyright © 2017年 梁晨. All rights reserved.
//

#import "MainCatergyV.h"

@implementation MainCatergyV

/*
 @property(nonatomic,strong)UIButton *WoWaGL;
 @property(nonatomic,strong)UIButton *LessonGL;
 @property(nonatomic,strong)UIButton *LesRecordGL;
 @property(nonatomic,strong)UIButton *KeLiGL;
 @property(nonatomic,strong)UIButton *HoildayGL;
 */
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.backgroundColor = [UIColor whiteColor];

        self.WoWaGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
//        [self.WoWaGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.WoWaGL setImage:[UIImage imageNamed:@"cateWoWa"] forState:(UIControlStateNormal)];
        [self.WoWaGL addTarget:self action:@selector(WoWaAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:self.WoWaGL];

        self.LessonGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
//        [self.LessonGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.LessonGL setImage:[UIImage imageNamed:@"cateLesson"] forState:(UIControlStateNormal)];
        [self.LessonGL addTarget:self action:@selector(LessonAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:self.LessonGL];

        self.LesRecordGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
//        [self.LesRecordGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.LesRecordGL addTarget:self action:@selector(LesRecordAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.LesRecordGL setImage:[UIImage imageNamed:@"CateRecord"] forState:(UIControlStateNormal)];
        [self addSubview:self.LesRecordGL];

        self.KeLiGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
//        [self.KeLiGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.KeLiGL addTarget:self action:@selector(KeLiAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.KeLiGL setImage:[UIImage imageNamed:@"cateKeLi"] forState:(UIControlStateNormal)];
        [self addSubview:self.KeLiGL];

        self.HoildayGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
//        [self.HoildayGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.HoildayGL addTarget:self action:@selector(HoildayAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.HoildayGL setImage:[UIImage imageNamed:@"cateHoilday"] forState:(UIControlStateNormal)];
        [self addSubview:self.HoildayGL];



        self.BanJiGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
        //        [self.WoWaGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.BanJiGL setImage:[UIImage imageNamed:@"teabanji"] forState:(UIControlStateNormal)];
        [self.BanJiGL addTarget:self action:@selector(BanjiAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:self.BanJiGL];

        self.TeaKeLiGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
        //        [self.LessonGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.TeaKeLiGL setImage:[UIImage imageNamed:@"teaKeli"] forState:(UIControlStateNormal)];
        [self.TeaKeLiGL addTarget:self action:@selector(TeakeliAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:self.TeaKeLiGL];

        self.QinJiaGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
        //        [self.LesRecordGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.QinJiaGL addTarget:self action:@selector(TeaQingajiAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.QinJiaGL setImage:[UIImage imageNamed:@"teaqingjiajilu"] forState:(UIControlStateNormal)];
        [self addSubview:self.QinJiaGL];

        self.TouSuGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
        //        [self.KeLiGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.TouSuGL addTarget:self action:@selector(teaTousuAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.TouSuGL setImage:[UIImage imageNamed:@"teatousu"] forState:(UIControlStateNormal)];
        [self addSubview:self.TouSuGL];

        self.ShouRuGL = [UIButton buttonWithType:(UIButtonTypeCustom)];
        //        [self.HoildayGL setTitle:@"我娃管理" forState:(UIControlStateNormal)];
        [self.ShouRuGL addTarget:self action:@selector(TeaShouruAct) forControlEvents:(UIControlEventTouchUpInside)];
        [self.ShouRuGL setImage:[UIImage imageNamed:@"teashouru"] forState:(UIControlStateNormal)];
        [self addSubview:self.ShouRuGL];

        /*@property(nonatomic,strong)UIButton *BanJiGL;
         @property(nonatomic,strong)UIButton *TeaKeLiGL;
         @property(nonatomic,strong)UIButton *QinJiaGL;
         @property(nonatomic,strong)UIButton *TouSuGL;
         @property(nonatomic,strong)UIButton *ShouRuGL;

         @property(nonatomic,strong)UILabel *BanJiL;
         @property(nonatomic,strong)UILabel *TeaKeLiL;
         @property(nonatomic,strong)UILabel *QinJiaL;
         @property(nonatomic,strong)UILabel *TouSuL;
         @property(nonatomic,strong)UILabel *ShouRuL;*/
        self.BanJiL = [[UILabel alloc]init];
        self.BanJiL.text = @"教学班级";
        self.BanJiL.font = [UIFont systemFontOfSize:13];
        self.BanJiL.textColor = UIColors(0x444444);
        [self addSubview:self.BanJiL];

        self.TeaKeLiL = [[UILabel alloc]init];
        self.TeaKeLiL.text = @"课例管理";
        self.TeaKeLiL.font = [UIFont systemFontOfSize:13];
        self.TeaKeLiL.textColor = UIColors(0x444444);
        [self addSubview:self.TeaKeLiL];

        self.QinJiaL = [[UILabel alloc]init];
        self.QinJiaL.text = @"我的请假";
        self.QinJiaL.font = [UIFont systemFontOfSize:13];
        self.QinJiaL.textColor = UIColors(0x444444);
        [self addSubview:self.QinJiaL];

        self.TouSuL = [[UILabel alloc]init];
        self.TouSuL.text = @"投诉留言";
        self.TouSuL.font = [UIFont systemFontOfSize:13];
        self.TouSuL.textColor = UIColors(0x444444);
        [self addSubview:self.TouSuL];

        self.ShouRuL = [[UILabel alloc]init];
        self.ShouRuL.text = @"我的收入";
        self.ShouRuL.font = [UIFont systemFontOfSize:13];
        self.ShouRuL.textColor = UIColors(0x444444);
        [self addSubview:self.ShouRuL];





        self.WoWaL = [[UILabel alloc]init];
        self.WoWaL.text = @"我娃管理";
        self.WoWaL.font = [UIFont systemFontOfSize:13];
        self.WoWaL.textColor = UIColors(0x444444);
        [self addSubview:self.WoWaL];

        self.LessonL = [[UILabel alloc]init];
        self.LessonL.text = @"课程管理";
        self.LessonL.font = [UIFont systemFontOfSize:13];
        self.LessonL.textColor = UIColors(0x444444);
        [self addSubview:self.LessonL];

        self.LesRecordL = [[UILabel alloc]init];
        self.LesRecordL.text = @"上课记录";
        self.LesRecordL.font = [UIFont systemFontOfSize:13];
        self.LesRecordL.textColor = UIColors(0x444444);
        [self addSubview:self.LesRecordL];

        self.KeLiL = [[UILabel alloc]init];
        self.KeLiL.text = @"课例共享";
        self.KeLiL.font = [UIFont systemFontOfSize:13];
        self.KeLiL.textColor = UIColors(0x444444);
        [self addSubview:self.KeLiL];

        self.HoildayL = [[UILabel alloc]init];
        self.HoildayL.text = @"我要请假";
        self.HoildayL.font = [UIFont systemFontOfSize:13];
        self.HoildayL.textColor = UIColors(0x444444);
        [self addSubview:self.HoildayL];

    }
    return self;
}

-(void)layoutSubviews
{
    [self.WoWaGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.BanJiGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.WoWaL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.WoWaGL.mas_centerX);
        make.top.equalTo(self.WoWaGL.mas_bottom).offset(-3);
    }];

    [self.BanJiL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.BanJiGL.mas_centerX);
        make.top.equalTo(self.BanJiGL.mas_bottom).offset(-3);
    }];


    [self.LessonGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.WoWaGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.TeaKeLiGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.BanJiGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];


    [self.LessonL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.LessonGL.mas_centerX);
        make.top.equalTo(self.LessonGL.mas_bottom).offset(-3);
    }];

    [self.TeaKeLiL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.TeaKeLiGL.mas_centerX);
        make.top.equalTo(self.TeaKeLiGL.mas_bottom).offset(-3);
    }];

    [self.LesRecordGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.LessonGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.QinJiaGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.TeaKeLiGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];


    [self.LesRecordL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.LesRecordGL.mas_centerX);
        make.top.equalTo(self.LesRecordGL.mas_bottom).offset(-3);
    }];

    [self.QinJiaL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.QinJiaGL.mas_centerX);
        make.top.equalTo(self.QinJiaGL.mas_bottom).offset(-3);
    }];


    [self.KeLiGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.LesRecordGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.TouSuGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.QinJiaGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.KeLiL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.KeLiGL.mas_centerX);
        make.top.equalTo(self.KeLiGL.mas_bottom).offset(-3);
    }];

    [self.TouSuL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.TouSuGL.mas_centerX);
        make.top.equalTo(self.TouSuGL.mas_bottom).offset(-3);
    }];


    [self.HoildayGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.KeLiGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.ShouRuGL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.TouSuGL.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.mas_equalTo(KscreenW/5);
        make.height.mas_equalTo(KscreenW/5);
    }];

    [self.HoildayL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.HoildayGL.mas_centerX);
        make.top.equalTo(self.HoildayGL.mas_bottom).offset(-3);
    }];
    [self.ShouRuL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.ShouRuGL.mas_centerX);
        make.top.equalTo(self.ShouRuGL.mas_bottom).offset(-3);
    }];
}

-(void)WoWaAct
{
    [self.Delegate didSelectAtIndex:0];
}

-(void)LessonAct
{

    [self.Delegate didSelectAtIndex:1];
}

-(void)LesRecordAct
{
    [self.Delegate didSelectAtIndex:2];
}

-(void)KeLiAct
{
    [self.Delegate didSelectAtIndex:3];
}

-(void)HoildayAct
{
    [self.Delegate didSelectAtIndex:4];
}

-(void)BanjiAct
{
    [self.Delegate didSelectAtIndex:5];
}

-(void)TeakeliAct
{
    [self.Delegate didSelectAtIndex:6];
}

-(void)TeaQingajiAct
{
    [self.Delegate didSelectAtIndex:7];
}

-(void)teaTousuAct
{
    [self.Delegate didSelectAtIndex:8];
}

-(void)TeaShouruAct
{
    [self.Delegate didSelectAtIndex:9];
}

-(void)QieHuan:(NSString *)isTeacher
{
    if ([isTeacher isEqualToString:@"1"])
    {
        [self ChangeTeacher];
    }else
    {
        [self ChangeJiaZhang];
    }
}


-(void)ChangeJiaZhang
{
    [self.WoWaGL setHidden:NO];
    [self.LessonGL setHidden:NO];
    [self.LesRecordGL setHidden:NO];
    [self.KeLiGL setHidden:NO];
    [self.HoildayGL setHidden:NO];
    [self.WoWaL setHidden:NO];
    [self.LessonL setHidden:NO];
    [self.LesRecordL setHidden:NO];
    [self.KeLiL setHidden:NO];
    [self.HoildayL setHidden:NO];

    [self.BanJiGL setHidden:YES];
    [self.TeaKeLiGL setHidden:YES];
    [self.QinJiaGL setHidden:YES];
    [self.TouSuGL setHidden:YES];
    [self.ShouRuGL setHidden:YES];

    [self.BanJiL setHidden:YES];
    [self.TeaKeLiL setHidden:YES];
    [self.QinJiaL setHidden:YES];
    [self.TouSuL setHidden:YES];
    [self.ShouRuL setHidden:YES];
    

}



-(void)ChangeTeacher
{
    [self.WoWaGL setHidden:YES];
    [self.LessonGL setHidden:YES];
    [self.LesRecordGL setHidden:YES];
    [self.KeLiGL setHidden:YES];
    [self.HoildayGL setHidden:YES];
    [self.WoWaL setHidden:YES];
    [self.LessonL setHidden:YES];
    [self.LesRecordL setHidden:YES];
    [self.KeLiL setHidden:YES];
    [self.HoildayL setHidden:YES];

    [self.BanJiGL setHidden:NO];
    [self.TeaKeLiGL setHidden:NO];
    [self.QinJiaGL setHidden:NO];
    [self.TouSuGL setHidden:NO];
    [self.ShouRuGL setHidden:NO];

    [self.BanJiL setHidden:NO];
    [self.TeaKeLiL setHidden:NO];
    [self.QinJiaL setHidden:NO];
    [self.TouSuL setHidden:NO];
    [self.ShouRuL setHidden:NO];




    /*

     @property(nonatomic,strong)UILabel *BanJiL;
     @property(nonatomic,strong)UILabel *TeaKeLiL;
     @property(nonatomic,strong)UILabel *QinJiaL;
     @property(nonatomic,strong)UILabel *TouSuL;
     @property(nonatomic,strong)UILabel *ShouRuL;*/



}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
